#!/usr/bin/python

import os

from google.appengine.api import users

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

from vateblog.util.MemCache import MemCache

class HandlerBase(webapp.RequestHandler):

	attributes = {}

	def add_attribute(self, key, value):
		self.attributes[key] = value

	def render(self, page):
		base = os.path.dirname(__file__)
		temp = os.path.join(base, '../template/' + page)

		self.response.out.write(template.render(temp, self.attributes))

	def get_current_user(self):
		return users.get_current_user()

	def get_blog_info(self):
		return MemCache.get_blog_info()
